{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ```info()``` Function"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The ```info()``` function provides guidelines for using Connector.\n",
    "\n",
    "**info() can be called using a Connector object, without parameters:**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "from dataprep.connector import connect, info\n",
    "\n",
    "# Access tokens can be accessed generated here: https://www.yelp.com/developers/documentation/v3/authentication\n",
    "dc = connect('yelp', _auth={'access_token':'cCMHU4M4t7rdt*********vp3whGzFjgIKIm0'})\n",
    "\n",
    "dc.info()\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Or by specifying the API to query as a parameter:**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "info('yelp')\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Parameters\n",
    "\n",
    "* ```config_path``` is the path to the folder containing configuration files. There are two ways to load configuration files. Details can be found in the previous configuraton file section.\n",
    "\n",
    "* ```update``` is used to specify if new configuration files should be pulled from the GitHub repo where up to date configuration files are hosted."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Response\n",
    "\n",
    "* ```Table``` displays table(s) of data that can be accessed. Each table has a corresponding API endpoint which will be queried automatically by connector.\n",
    "* ```Parameters``` identifies parameters that can be used in the query function to access specific data. info() indicates if the parameter is required for all queries of the specified table.\n",
    "* ```Examples``` shows how methods of the Connector class can be called. The access_token value must be replaced with an authorization key that can be generated by following instructions on the developer website of the API.\n",
    "* ```Schema``` displays column names and column data types of the DataFrame returned by the query function."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Examples   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Below shows the case for the Yelp website. You can see:\n",
    "\n",
    "* Yelp has one table: \"businesses\".\n",
    "\n",
    "* The businesses table has seven parameters: location, term, latitude, longitude, limit, categories and sort_by. The location parameter is required, while the other parameters are optional.\n",
    "\n",
    "* The example shows how to connect and query Yelp. More details can be found in the \"connect\" and \"query\" sections.\n",
    "\n",
    "* The schema shows there will be 20 columns of data returned. Each row of the schema displays a column name and its corresponding data type. For example the \"name\" and \"image_url\" columns contain string data while \"latitude\" and \"longitude\" columns contain float data."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "from dataprep.connector import info\n",
    "info('yelp', update=True)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![title](assets/yelp-1.png)\n",
    "![title](assets/yelp-2.png)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
